package com.smartrm.trade.domain.valueobject;

import com.smartrm.globalinfrcore.common.MathUtil;

import java.util.List;

/*
 * @program: common-starters
 * @description: 自动售卖机商品列表值对象
 * @author: houhong
 * @create: 2023-01-10 16:32
 */
public final class VendingMachineCommodityListVOJ {

    /*
     * 自动售卖机实体唯一标识
     */
    private final long machineId;
    /*
     * 售卖机商品列表
     */
    private final List<StockedCommodityVOJ> commodityVOJList;

    public VendingMachineCommodityListVOJ(long machineId, List<StockedCommodityVOJ> commodityVOJList) {
        this.machineId = machineId;
        this.commodityVOJList = commodityVOJList;
    }

    public long machineId() {
        return machineId;
    }

    public List<StockedCommodityVOJ> commodities() {
        return commodityVOJList;
    }

    @Override
    public boolean equals(Object other) {
        if (other == null || this.getClass() != other.getClass()) {
            return false;
        }
        VendingMachineCommodityListVOJ list = (VendingMachineCommodityListVOJ) other;
        return this.machineId == list.machineId && list.commodityVOJList.equals(this.commodityVOJList);
    }

    @Override
    public int hashCode() {
        int ret = MathUtil.HASH_MAGIC_NUMBER + (int) this.machineId + this.commodityVOJList.hashCode();
        return ret;
    }

    public long getMachineId() {
        return machineId;
    }

    public List<StockedCommodityVOJ> getCommodityVOJList() {
        return commodityVOJList;
    }
}